#!/bin/bash
echo "请输入一个整数数组，以空格分隔:"
read -a arr

echo "原始数组: ${arr[*]}"

n=${#arr[@]}

for ((i=0; i<n-1; i++))
do
    for ((j=0; j<n-i-1; j++))
    do
        if ((arr[j] > arr[j+1]))
        then
            temp=${arr[j]}
            arr[j]=${arr[j+1]}
            arr[j+1]=$temp
        fi
    done
done

echo "排序后的数组: ${arr[*]}"
